<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>HttpRequestPool constructor</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="httprequestpool.attach.html">HttpRequestPool::attach</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="httprequestpool.destruct.html">HttpRequestPool::__destruct</a></div>
 <div class="up"><a href="class.httprequestpool.html">HttpRequestPool</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="httprequestpool.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">HttpRequestPool::__construct</h1>
  <p class="verinfo">(PECL pecl_http &gt;= 0.10.0)</p><p class="refpurpose"><span class="refname">HttpRequestPool::__construct</span> &mdash; <span class="dc-title">HttpRequestPool constructor</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-httprequestpool.construct-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>HttpRequestPool::__construct</strong></span>
    ([ <span class="methodparam"><span class="type"><a href="class.httprequest.html" class="type HttpRequest">HttpRequest</a></span> <code class="parameter">$request</code></span>
   [, <span class="methodparam"><span class="type"><a href="class.httprequest.html" class="type HttpRequest">HttpRequest</a></span> <code class="parameter">$...</code></span>
  ]] )</div>


  <p class="para rdfs-comment">
   Instantiate a new <a href="class.httprequestpool.html" class="classname">HttpRequestPool</a> object. An <a href="class.httprequestpool.html" class="classname">HttpRequestPool</a> is
   able to send several <strong class="classname">HttpRequests</strong> in parallel.
  </p>
  <p class="para">
   Accepts virtually infinite optional parameters each referencing an <a href="class.httprequest.html" class="classname">HttpRequest</a> object.
  </p>

 </div>

 <div class="refsect1 parameters" id="refsect1-httprequestpool.construct-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">request</code></em></dt>

     <dd>

      <p class="para">
       <a href="class.httprequest.html" class="classname">HttpRequest</a> object to attach
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">...</code></em></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-httprequestpool.construct-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   Throws <strong class="classname">HttpRequestPoolException</strong> (<strong class="classname">HttpRequestException</strong>, <strong class="classname">HttpInvalidParamException</strong>).
  </p>
 </div>



 


 <div class="refsect1 examples" id="refsect1-httprequestpool.construct-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4261">
    <p><strong>Example #1 A <a href="class.httprequestpool.html" class="classname">HttpRequestPool</a> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">try&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$pool&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">HttpRequestPool</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://www.google.com/'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">::</span><span style="color: #0000BB">METH_HEAD</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://www.php.net/'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">HttpRequest</span><span style="color: #007700">::</span><span style="color: #0000BB">METH_HEAD</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$pool</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;foreach(</span><span style="color: #0000BB">$pool&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$request</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%s&nbsp;is&nbsp;%s&nbsp;(%d)\n"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getUrl</span><span style="color: #007700">(),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getResponseCode</span><span style="color: #007700">()&nbsp;?&nbsp;</span><span style="color: #DD0000">'alive'&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #DD0000">'not&nbsp;alive'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$request</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getResponseCode</span><span style="color: #007700">()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}&nbsp;catch&nbsp;(</span><span style="color: #0000BB">HttpException&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$e</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>



 


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="httprequestpool.attach.html">HttpRequestPool::attach</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="httprequestpool.destruct.html">HttpRequestPool::__destruct</a></div>
 <div class="up"><a href="class.httprequestpool.html">HttpRequestPool</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
